<?php
/**
 * @copyright 2011
 * @version $Id$
 * @access public
 * @author Oriotiori

 */
class Default_Form_LoginForm extends Zend_Form
{
    
    public function __construct($option = null)
    {
        parent::__construct($option);
	  
        $translate = Zend_Registry::get('Zend_Translate');
       
        $this
                ->setMethod('post')
                ->setAttribs(array('class' => 'login-form'))
                ->setName('login');

        $username = new Zend_Form_Element_Text('Username');
        $username->setLabel('Usuario')
                ->addFilter('StripTags')    //evita introducir codigo html
                ->setRequired(true)
                ->setOptions(array('requiredSuffix' => ' *'))
                ->setAttribs(array(true,'maxlength'  => 70))
                ->addValidator('NotEmpty', true)
                ->addErrorMessage('Este campo es requerido, y no puede quedar vacio.'); ;
                ;

        $password = new Zend_Form_Element_Password('Password');
        $password->setLabel('Contraseña')
                ->addFilter('StripTags')
                ->setRequired(true)
                ->setOptions(array('requiredSuffix' => ' *'))
                ->setAttribs(array(true,'maxlength'  => 20))
                ->addValidator('NotEmpty', true)
                ->addErrorMessage('Este campo es requerido, y no puede quedar vacio.'); ;

        $this->addElements(array($username, $password));
        $this->setElementFilters(array('StringTrim'));
        
        $this->setAction(Zend_Controller_Front::getInstance()->getBaseUrl() .  DIAG_PATH .  'login');

    }
	
}